package com.googlecode.chigs.web.doku.genericscript;

import com.googlecode.chigs.domain.GenericScript;
import org.apache.wicket.authorization.strategies.role.annotations.AuthorizeInstantiation;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.TextArea;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.model.StringResourceModel;

/**
 * @author the
 */
@AuthorizeInstantiation("ROLE_USER")
public class EditGenericScriptFormularPanel extends Panel {

	public EditGenericScriptFormularPanel(String id, IModel<GenericScript> model) {
		super(id, model);
		StringResourceModel lName = new StringResourceModel("name.label", EditGenericScriptFormularPanel.this, null);
		add(new Label("name.label", lName));
		add(new TextField<String>("name", new PropertyModel<String>(model.getObject(), "name"))
				.setRequired(true)
				.setLabel(lName));

		StringResourceModel lScript = new StringResourceModel("script.label", EditGenericScriptFormularPanel.this, null);
		add(new Label("script.label", lScript));
		add(new TextArea<String>("script", new PropertyModel<String>(model.getObject(), "script"))
				.setRequired(true)
				.setLabel(lScript));

	}
}

